﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace Components
{
    public class GlobalVariable
    {
        private string _VarName;
        /// <summary></summary>
        public string VarName
        {
            get { return _VarName; }
            set { _VarName = value; }
        }

        private SimpleDataType _DataType;
        /// <summary></summary>
        public SimpleDataType DataType
        {
            get { return _DataType; }
            set { _DataType = value; }
        }

        private object _VarValue;
        /// <summary></summary>
        public string VarValue
        {
            get { return this._VarValue == null ? string.Empty : this._VarValue.ToString(); }
            set { _VarValue = SimpleDataTypeUtil.ToDbValue(this._DataType, value); }
        }
        /// <summary></summary>
        public GlobalVariable()
        {
            this._VarName = "Parameter 1";
            this._VarValue = string.Empty;
            this._DataType = SimpleDataType.TextType;
        }
        /// <summary></summary>
        public GlobalVariable(string name, SimpleDataType dbtype, object val)
        {
            this._VarName = name;
            this._DataType = dbtype;
            this._VarValue = val;
        }
    }
}
